//**************************************************************.DA*
//   .MODULE [ KFXUser.c ]
//--------------------------------------------------------------.D1-
//   .FILE [ KFXUser.c ]                           .PROGRAM [   ]
//   .GROUP [ KEFEX Protocol ]                  .VERSION [ 0.01 ]
//   .AUTHOR [ Stangl ]
//--------------------------------------------------------------.F1-
//   .DESCRIPTION
//   user editable functions of KEFEX protocol adaption
//--------------------------------------------------------------
//   .SPEC
//   "SOFTWAREANFORDERUNGEN DER SWKE KEFEX++"
//--------------------------------------------------------------
//   .HISTORY
//    Date       Author      Commentary
//    14.05.02   CF          created
//**************************************************************.DE*
#include "kfxconfig.h"
#include "KFXeep.h"

#include "KFX_RAM.h"

//**************************************************************.FA*
//   .FUNCTION [ KFX_update_task ]
//   .GROUP [ KEFEX EE functions ]
//   .AUTHOR [ STW ]
//--------------------------------------------------------------.F1-
//   .DESCRIPTION
//   Will be executed when the ECU receives an update task request
//   e.g. from E2Edit
//--------------------------------------------------------------
//   .PARAMETERS
//    Bezeichner             Bedeutung
//    uint16 ou16_TaskIndex  Number of task which was updated
//--------------------------------------------------------------
//   .RETURNVALUE
//   C_NO_ERR              ok
//--------------------------------------------------------------
//   .VARIABLE_REFERENCES
//--------------------------------------------------------------
//   .HISTORY
//    Date       Author      Commentary
//**************************************************************.FE*
sint16 KFX_update_task(uint16 ou16_TaskIndex)
{
   return KFX_read_eeprom_list(ou16_TaskIndex, 0);
}

//**************************************************************.FA*
//   .FUNCTION [ KFX_get_variable_action ]
//   .GROUP [ KEFEX EE functions ]
//   .AUTHOR [ STW ]
//--------------------------------------------------------------.F1-
//   .DESCRIPTION
//   Will be executed when the ECU receives an read variable request
//    for a value which is defined as function call (= location function)
//--------------------------------------------------------------
//   .PARAMETERS
//    Bezeichner          Bedeutung
//   uint8 ou8_Task       Index of task
//   uint16 ou16_Index    Index of variable
//   uint32 *opu32_Value  place your result here
//--------------------------------------------------------------
//   .RETURNVALUE
//   C_NO_ERR              ok
//--------------------------------------------------------------
//   .VARIABLE_REFERENCES
//--------------------------------------------------------------
//   .HISTORY
//    Date       Author      Commentary
//**************************************************************.FE*
sint16 KFX_get_variable_action(uint8 ou8_Task, uint16 ou16_Index, uint32 *opu32_Value)
{
   return(C_RANGE);
}

//**************************************************************.FA*
//   .FUNCTION [ KFX_set_variable_action ]
//   .GROUP [ KEFEX EE functions ]
//   .AUTHOR [ STW ]
//--------------------------------------------------------------.F1-
//   .DESCRIPTION
//   Will be executed when the ECU receives an write variable request
//    for a value which is defined as function call (= location function)
//--------------------------------------------------------------
//   .PARAMETERS
//    Bezeichner          Bedeutung
//   uint8 ou8_Task       Index of task
//   uint16 ou16_Index    Index of variable
//   uint32 ou32_Value    parameter value
//--------------------------------------------------------------
//   .RETURNVALUE
//   C_NO_ERR              ok
//--------------------------------------------------------------
//   .VARIABLE_REFERENCES
//--------------------------------------------------------------
//   .HISTORY
//    Date       Author      Commentary
//**************************************************************.FE*
sint16 KFX_set_variable_action(uint8 ou8_Task, uint16 ou16_Index, uint32 ou32_Value)
{
   return(C_RANGE);
}

//**************************************************************.FA*
//   .FUNCTION [ KFX_get_segmented_download_data ]
//   .GROUP [ KEFEX EE functions ]
//   .AUTHOR [ STW ]
//--------------------------------------------------------------.F1-
//   .DESCRIPTION
//   Will be executed when the ECU receives an read variable request
//    for a value which is larger than 4 bytes. The user may set a
//    pointer to a memory area with the values for the specified index.
//--------------------------------------------------------------
//   .PARAMETERS
//   Bezeichner            Bedeutung
//   byte ou8_Task         Index of task
//   uint16 ou16_Index     Index of variable
//   uint32 ou32_Size      requested data size
//   void **oppv_Data      output: pointer to data
//--------------------------------------------------------------
//   .RETURNVALUE
//   C_NO_ERR              ok
//--------------------------------------------------------------
//   .VARIABLE_REFERENCES
//--------------------------------------------------------------
//   .HISTORY
//    Date       Author      Commentary
//**************************************************************.FE*
sint16 KFX_get_segmented_download_data(uint8 ou8_Task,uint16 ou16_Index,byte ou8_Parameter,uint32 ou32_Size,
                                       void KFX_TRG_HUGE **oppv_Data)
{
   return(C_RANGE);
}

//**************************************************************.FA*
//   .FUNCTION [ KFX_get_segmented_upload_data ]
//   .GROUP [ KEFEX EE functions ]
//   .AUTHOR [ STW ]
//--------------------------------------------------------------.F1-
//   .DESCRIPTION
//   Will be executed when the ECU receives an write variable request
//    for a value which is larger than 4 bytes. The user may set a
//    pointer to a memory area with the values for the specified index.
//--------------------------------------------------------------
//   .PARAMETERS
//   Bezeichner           Bedeutung
//   byte ou8_Task        Index of task
//   uint16 ou16_Index    Index of variable
//   uint32 ou32_Size     requested data size
//   void **oppv_Data     output: pointer to data
//--------------------------------------------------------------
//   .RETURNVALUE
//   C_NO_ERR              ok
//--------------------------------------------------------------
//   .VARIABLE_REFERENCES
//--------------------------------------------------------------
//   .HISTORY
//    Date       Author      Commentary
//**************************************************************.FE*
sint16 KFX_get_segmented_upload_data(uint8 ou8_Task, uint16 ou16_Index,uint8 ou8_Parameter,uint32 ou32_Size,
                                     void KFX_TRG_HUGE **oppv_Data)
{
   return(C_RANGE);
}

//**************************************************************.FA*
//   .FUNCTION [ KFX_get_segmented_upload_data ]
//   .GROUP [ KEFEX EE functions ]
//   .AUTHOR [ STW ]
//--------------------------------------------------------------.F1-
//   .DESCRIPTION
//   Will be executed when the transfer of a value larger than 4
//    4 bytes to the ECU has been finished. The user can use the
//    new value from then on.
//--------------------------------------------------------------
//   .PARAMETERS
//   Bezeichner           Bedeutung
//   uint8 ou8_Task       Index of task
//   uint16 ou16_Index    Index of variable
//--------------------------------------------------------------
//   .RETURNVALUE
//   C_NO_ERR              ok
//--------------------------------------------------------------
//   .VARIABLE_REFERENCES
//--------------------------------------------------------------
//   .HISTORY
//    Date       Author      Commentary
//**************************************************************.FE*
void KFX_segmented_upload_finished(uint8 ou8_Task,uint16 ou16_Index,uint8 ou8_Parameter)
{
   //there are no segmented transfers used in this project
}
